#ifndef COMMON_MYERROR_H
#define COMMON_MYERROR_H


namespace common {

class Error {
  public:
    //Error codes.
    enum code {
      noError,//No errors
      generalError,//something happened but we don't know how to describe it (should be never used)
      parameterMissing,//NULL in parameter where where object was expected
      parameterWrong,//one of parameters has wrong values
      objectNotFound,//object we passed descriptor to, doesn't exist in a place where we described
      objectNotInitialized,//object exist but isn't configured properly yet
      objectAlreadyInitialized,//we're trying to initialize object that already went trough that process
      objectDamaged,//self control of the object returns errors about it's content
      objectDeleted,//object has been signed for deletion, can't be used anymore.
      noWaitingThread,//There was no thread to switch to.
      systemError,//Placeholder item for the firts error returned by GetLastError().
      //Later we could try to translate most of the errors.
      waitAbandoned,//Object that we waited for has been abandoned.
      //We gained ownership, but we enter on our risk.
      waitTimeout//We didn't gain ownership of the object before the given timeout.

    };

    //Creates Error object with given code.
    Error(code errorCode);

    //Throw an exception of this type.
    static void Throw(code errorCode);


  private:
    code mErrorCode;


  public:
    //Returns error code of this object.
    code GetErrorCode();

};

} // namespace common
#endif
